<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            text-align: center;
             margin-top: 50px;
        }
        #studentName{
            font-size:2em;
            color:#3498db;
    	}
            	
    </style>	
</head>
<body>
    <h1>随机点名</h1>
    <div id="studentName">点击按钮点名</div>
</body>
<script>
    console.log('-------------------------------');	
    console.log();
    /*
    创键对象的三种方法:
    step1:字面里创建(描述对象》
    step2: 构造函数创键对象:第一步定义构造函数，第二部实例化对象 
    step3: new Object()
    */
   //MDN网站中javascript中的参数
    console.log(Math.PI);//圆周率
    console.log(Math.max(1,45,78,1236,-4556,0,99,-1111));//最大值 
    console.log(Math.random());//随机款
    console.log('-------------------------------');

    //随机数	
    function getRandomInt(max){	
        return Math.floor(Math.random() * max); 
    }
    console.log(Math.random( ));
    console.log('-------------------------------');	
    //随机点名	
    let students=['张三','李四','王二','麻子','可乐','蓄条'];	
    function Pickrandomstudents(){	
        let random=Math.floor (Math.random( )*students.length);
    	let selectstudents=students[random];	
        document.getElementById("studentName").innerText=selectstudents;
    }
    
    
    console.log(Pickrandomstudents());
    console.log('-------------------------------');	
    //随机猜数字		
    function cai(min,max){
        return Math.floor(Math.random()*(max-min-1)+min);
         let boom=cai(1,10); 
         let num; 
         while(true){
            num=prompt("输入你猜的数字;");
            if(num===boom){
                alert("你踩重了");
                 break;
            }else if(num>boom){
                alert("你猜大了");
            }else{
                alert("你猜小了");
            }
        }
    }
</script>
</html>